3.240 \(\int \frac{\cot (e+f x)}{(a+b \tan ^2(e+f x))^3} \, dx\)

Optimal. Leaf size=148 \[ \frac{b \left (3 a^2-3 a b+b^2\right ) \log \left (a+b \tan ^2(e+f x)\right )}{2 a^3 f (a-b)^3}-\frac{b (2 a-b)}{2 a^2 f (a-b)^2 \left (a+b \tan ^2(e+f x)\right )}+\frac{\log (\tan (e+f x))}{a^3 f}-\frac{b}{4 a f (a-b) \left (a+b \tan ^2(e+f x)\right )^2}+\frac{\log (\cos (e+f x))}{f (a-b)^3} \]

[Out]

Log[Cos[e + f*x]]/((a - b)^3*f) + Log[Tan[e + f*x]]/(a^3*f) + (b*(3*a^2 - 3*a*b + b^2)*Log[a + b*Tan[e + f*x]^
2])/(2*a^3*(a - b)^3*f) - b/(4*a*(a - b)*f*(a + b*Tan[e + f*x]^2)^2) - ((2*a - b)*b)/(2*a^2*(a - b)^2*f*(a + b
*Tan[e + f*x]^2))

________________________________________________________________________________________

Rubi [A]  time = 0.165032, antiderivative size = 148, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.143, Rules used = {3670, 446, 72} \[ \frac{b \left (3 a^2-3 a b+b^2\right ) \log \left (a+b \tan ^2(e+f x)\right )}{2 a^3 f (a-b)^3}-\frac{b (2 a-b)}{2 a^2 f (a-b)^2 \left (a+b \tan ^2(e+f x)\right )}+\frac{\log (\tan (e+f x))}{a^3 f}-\frac{b}{4 a f (a-b) \left (a+b \tan ^2(e+f x)\right )^2}+\frac{\log (\cos (e+f x))}{f (a-b)^3} \]

Antiderivative was successfully verified.

[In]

Int[Cot[e + f*x]/(a + b*Tan[e + f*x]^2)^3,x]

[Out]

Log[Cos[e + f*x]]/((a - b)^3*f) + Log[Tan[e + f*x]]/(a^3*f) + (b*(3*a^2 - 3*a*b + b^2)*Log[a + b*Tan[e + f*x]^
2])/(2*a^3*(a - b)^3*f) - b/(4*a*(a - b)*f*(a + b*Tan[e + f*x]^2)^2) - ((2*a - b)*b)/(2*a^2*(a - b)^2*f*(a + b
*Tan[e + f*x]^2))

Rule 3670

Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol]
 :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[(c*ff)/f, Subst[Int[(((d*ff*x)/c)^m*(a + b*(ff*x)^n)^p)/(c^
2 + ff^2*x^2), x], x, (c*Tan[e + f*x])/ff], x]] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && (IGtQ[p, 0] || EqQ
[n, 2] || EqQ[n, 4] || (IntegerQ[p] && RationalQ[n]))

Rule 446

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[x^(Simplify[(m + 1)/n] - 1)*(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] &&
 NeQ[b*c - a*d, 0] && IntegerQ[Simplify[(m + 1)/n]]

Rule 72

Int[((e_.) + (f_.)*(x_))^(p_.)/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), x_Symbol] :> Int[ExpandIntegrand[(
e + f*x)^p/((a + b*x)*(c + d*x)), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && IntegerQ[p]

Rubi steps

\begin{align*} \int \frac{\cot (e+f x)}{\left (a+b \tan ^2(e+f x)\right )^3} \, dx &=\frac{\operatorname{Subst}\left (\int \frac{1}{x \left (1+x^2\right ) \left (a+b x^2\right )^3} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac{\operatorname{Subst}\left (\int \frac{1}{x (1+x) (a+b x)^3} \, dx,x,\tan ^2(e+f x)\right )}{2 f}\\ &=\frac{\operatorname{Subst}\left (\int \left (\frac{1}{a^3 x}-\frac{1}{(a-b)^3 (1+x)}+\frac{b^2}{a (a-b) (a+b x)^3}+\frac{(2 a-b) b^2}{a^2 (a-b)^2 (a+b x)^2}+\frac{b^2 \left (3 a^2-3 a b+b^2\right )}{a^3 (a-b)^3 (a+b x)}\right ) \, dx,x,\tan ^2(e+f x)\right )}{2 f}\\ &=\frac{\log (\cos (e+f x))}{(a-b)^3 f}+\frac{\log (\tan (e+f x))}{a^3 f}+\frac{b \left (3 a^2-3 a b+b^2\right ) \log \left (a+b \tan ^2(e+f x)\right )}{2 a^3 (a-b)^3 f}-\frac{b}{4 a (a-b) f \left (a+b \tan ^2(e+f x)\right )^2}-\frac{(2 a-b) b}{2 a^2 (a-b)^2 f \left (a+b \tan ^2(e+f x)\right )}\\ \end{align*}

Mathematica [A]  time = 1.6598, size = 126, normalized size = 0.85 \[ \frac{\frac{\frac{b \left (2 \left (3 a^2-3 a b+b^2\right ) \log \left (a+b \tan ^2(e+f x)\right )-\frac{a (a-b) \left (2 b (2 a-b) \tan ^2(e+f x)+a (5 a-3 b)\right )}{\left (a+b \tan ^2(e+f x)\right )^2}\right )}{(a-b)^3}+4 \log (\tan (e+f x))}{a^3}+\frac{4 \log (\cos (e+f x))}{(a-b)^3}}{4 f} \]

Antiderivative was successfully verified.

[In]

Integrate[Cot[e + f*x]/(a + b*Tan[e + f*x]^2)^3,x]

[Out]

((4*Log[Cos[e + f*x]])/(a - b)^3 + (4*Log[Tan[e + f*x]] + (b*(2*(3*a^2 - 3*a*b + b^2)*Log[a + b*Tan[e + f*x]^2
] - (a*(a - b)*(a*(5*a - 3*b) + 2*(2*a - b)*b*Tan[e + f*x]^2))/(a + b*Tan[e + f*x]^2)^2))/(a - b)^3)/a^3)/(4*f
)

________________________________________________________________________________________

Maple [B]  time = 0.098, size = 289, normalized size = 2. \begin{align*}{\frac{\ln \left ( \cos \left ( fx+e \right ) +1 \right ) }{2\,f{a}^{3}}}+{\frac{3\,{b}^{2}}{2\,fa \left ( a-b \right ) ^{3} \left ( a \left ( \cos \left ( fx+e \right ) \right ) ^{2}- \left ( \cos \left ( fx+e \right ) \right ) ^{2}b+b \right ) }}-{\frac{{b}^{3}}{2\,f{a}^{2} \left ( a-b \right ) ^{3} \left ( a \left ( \cos \left ( fx+e \right ) \right ) ^{2}- \left ( \cos \left ( fx+e \right ) \right ) ^{2}b+b \right ) }}+{\frac{3\,b\ln \left ( a \left ( \cos \left ( fx+e \right ) \right ) ^{2}- \left ( \cos \left ( fx+e \right ) \right ) ^{2}b+b \right ) }{2\,fa \left ( a-b \right ) ^{3}}}-{\frac{3\,{b}^{2}\ln \left ( a \left ( \cos \left ( fx+e \right ) \right ) ^{2}- \left ( \cos \left ( fx+e \right ) \right ) ^{2}b+b \right ) }{2\,f{a}^{2} \left ( a-b \right ) ^{3}}}+{\frac{{b}^{3}\ln \left ( a \left ( \cos \left ( fx+e \right ) \right ) ^{2}- \left ( \cos \left ( fx+e \right ) \right ) ^{2}b+b \right ) }{2\,f{a}^{3} \left ( a-b \right ) ^{3}}}-{\frac{{b}^{3}}{4\,fa \left ( a-b \right ) ^{3} \left ( a \left ( \cos \left ( fx+e \right ) \right ) ^{2}- \left ( \cos \left ( fx+e \right ) \right ) ^{2}b+b \right ) ^{2}}}+{\frac{\ln \left ( \cos \left ( fx+e \right ) -1 \right ) }{2\,f{a}^{3}}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(f*x+e)/(a+b*tan(f*x+e)^2)^3,x)

[Out]

1/2/f/a^3*ln(cos(f*x+e)+1)+3/2/f*b^2/a/(a-b)^3/(a*cos(f*x+e)^2-cos(f*x+e)^2*b+b)-1/2/f*b^3/a^2/(a-b)^3/(a*cos(
f*x+e)^2-cos(f*x+e)^2*b+b)+3/2/f*b/a/(a-b)^3*ln(a*cos(f*x+e)^2-cos(f*x+e)^2*b+b)-3/2/f*b^2/a^2/(a-b)^3*ln(a*co
s(f*x+e)^2-cos(f*x+e)^2*b+b)+1/2/f*b^3/a^3/(a-b)^3*ln(a*cos(f*x+e)^2-cos(f*x+e)^2*b+b)-1/4/f*b^3/a/(a-b)^3/(a*
cos(f*x+e)^2-cos(f*x+e)^2*b+b)^2+1/2/f/a^3*ln(cos(f*x+e)-1)

________________________________________________________________________________________

Maxima [A]  time = 1.11028, size = 338, normalized size = 2.28 \begin{align*} \frac{\frac{2 \,{\left (3 \, a^{2} b - 3 \, a b^{2} + b^{3}\right )} \log \left (-{\left (a - b\right )} \sin \left (f x + e\right )^{2} + a\right )}{a^{6} - 3 \, a^{5} b + 3 \, a^{4} b^{2} - a^{3} b^{3}} + \frac{6 \, a^{2} b^{2} - 3 \, a b^{3} - 2 \,{\left (3 \, a^{2} b^{2} - 4 \, a b^{3} + b^{4}\right )} \sin \left (f x + e\right )^{2}}{a^{7} - 3 \, a^{6} b + 3 \, a^{5} b^{2} - a^{4} b^{3} +{\left (a^{7} - 5 \, a^{6} b + 10 \, a^{5} b^{2} - 10 \, a^{4} b^{3} + 5 \, a^{3} b^{4} - a^{2} b^{5}\right )} \sin \left (f x + e\right )^{4} - 2 \,{\left (a^{7} - 4 \, a^{6} b + 6 \, a^{5} b^{2} - 4 \, a^{4} b^{3} + a^{3} b^{4}\right )} \sin \left (f x + e\right )^{2}} + \frac{2 \, \log \left (\sin \left (f x + e\right )^{2}\right )}{a^{3}}}{4 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)/(a+b*tan(f*x+e)^2)^3,x, algorithm="maxima")

[Out]

1/4*(2*(3*a^2*b - 3*a*b^2 + b^3)*log(-(a - b)*sin(f*x + e)^2 + a)/(a^6 - 3*a^5*b + 3*a^4*b^2 - a^3*b^3) + (6*a
^2*b^2 - 3*a*b^3 - 2*(3*a^2*b^2 - 4*a*b^3 + b^4)*sin(f*x + e)^2)/(a^7 - 3*a^6*b + 3*a^5*b^2 - a^4*b^3 + (a^7 -
 5*a^6*b + 10*a^5*b^2 - 10*a^4*b^3 + 5*a^3*b^4 - a^2*b^5)*sin(f*x + e)^4 - 2*(a^7 - 4*a^6*b + 6*a^5*b^2 - 4*a^
4*b^3 + a^3*b^4)*sin(f*x + e)^2) + 2*log(sin(f*x + e)^2)/a^3)/f

________________________________________________________________________________________

Fricas [B]  time = 1.89519, size = 895, normalized size = 6.05 \begin{align*} \frac{6 \, a^{3} b^{2} - 3 \, a^{2} b^{3} +{\left (5 \, a^{2} b^{3} - 2 \, a b^{4}\right )} \tan \left (f x + e\right )^{4} + 2 \,{\left (3 \, a^{3} b^{2} + a^{2} b^{3} - a b^{4}\right )} \tan \left (f x + e\right )^{2} + 2 \,{\left (a^{5} - 3 \, a^{4} b + 3 \, a^{3} b^{2} - a^{2} b^{3} +{\left (a^{3} b^{2} - 3 \, a^{2} b^{3} + 3 \, a b^{4} - b^{5}\right )} \tan \left (f x + e\right )^{4} + 2 \,{\left (a^{4} b - 3 \, a^{3} b^{2} + 3 \, a^{2} b^{3} - a b^{4}\right )} \tan \left (f x + e\right )^{2}\right )} \log \left (\frac{\tan \left (f x + e\right )^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) + 2 \,{\left (3 \, a^{4} b - 3 \, a^{3} b^{2} + a^{2} b^{3} +{\left (3 \, a^{2} b^{3} - 3 \, a b^{4} + b^{5}\right )} \tan \left (f x + e\right )^{4} + 2 \,{\left (3 \, a^{3} b^{2} - 3 \, a^{2} b^{3} + a b^{4}\right )} \tan \left (f x + e\right )^{2}\right )} \log \left (\frac{b \tan \left (f x + e\right )^{2} + a}{\tan \left (f x + e\right )^{2} + 1}\right )}{4 \,{\left ({\left (a^{6} b^{2} - 3 \, a^{5} b^{3} + 3 \, a^{4} b^{4} - a^{3} b^{5}\right )} f \tan \left (f x + e\right )^{4} + 2 \,{\left (a^{7} b - 3 \, a^{6} b^{2} + 3 \, a^{5} b^{3} - a^{4} b^{4}\right )} f \tan \left (f x + e\right )^{2} +{\left (a^{8} - 3 \, a^{7} b + 3 \, a^{6} b^{2} - a^{5} b^{3}\right )} f\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)/(a+b*tan(f*x+e)^2)^3,x, algorithm="fricas")

[Out]

1/4*(6*a^3*b^2 - 3*a^2*b^3 + (5*a^2*b^3 - 2*a*b^4)*tan(f*x + e)^4 + 2*(3*a^3*b^2 + a^2*b^3 - a*b^4)*tan(f*x +
e)^2 + 2*(a^5 - 3*a^4*b + 3*a^3*b^2 - a^2*b^3 + (a^3*b^2 - 3*a^2*b^3 + 3*a*b^4 - b^5)*tan(f*x + e)^4 + 2*(a^4*
b - 3*a^3*b^2 + 3*a^2*b^3 - a*b^4)*tan(f*x + e)^2)*log(tan(f*x + e)^2/(tan(f*x + e)^2 + 1)) + 2*(3*a^4*b - 3*a
^3*b^2 + a^2*b^3 + (3*a^2*b^3 - 3*a*b^4 + b^5)*tan(f*x + e)^4 + 2*(3*a^3*b^2 - 3*a^2*b^3 + a*b^4)*tan(f*x + e)
^2)*log((b*tan(f*x + e)^2 + a)/(tan(f*x + e)^2 + 1)))/((a^6*b^2 - 3*a^5*b^3 + 3*a^4*b^4 - a^3*b^5)*f*tan(f*x +
 e)^4 + 2*(a^7*b - 3*a^6*b^2 + 3*a^5*b^3 - a^4*b^4)*f*tan(f*x + e)^2 + (a^8 - 3*a^7*b + 3*a^6*b^2 - a^5*b^3)*f
)

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)/(a+b*tan(f*x+e)**2)**3,x)

[Out]

Timed out

________________________________________________________________________________________

Giac [A]  time = 1.63073, size = 360, normalized size = 2.43 \begin{align*} \frac{\frac{2 \,{\left (3 \, a^{2} b - 3 \, a b^{2} + b^{3}\right )} \log \left ({\left | -a \sin \left (f x + e\right )^{2} + b \sin \left (f x + e\right )^{2} + a \right |}\right )}{a^{6} - 3 \, a^{5} b + 3 \, a^{4} b^{2} - a^{3} b^{3}} - \frac{9 \, a^{3} b \sin \left (f x + e\right )^{4} - 18 \, a^{2} b^{2} \sin \left (f x + e\right )^{4} + 12 \, a b^{3} \sin \left (f x + e\right )^{4} - 3 \, b^{4} \sin \left (f x + e\right )^{4} - 18 \, a^{3} b \sin \left (f x + e\right )^{2} + 24 \, a^{2} b^{2} \sin \left (f x + e\right )^{2} - 8 \, a b^{3} \sin \left (f x + e\right )^{2} + 9 \, a^{3} b - 6 \, a^{2} b^{2}}{{\left (a^{5} - 2 \, a^{4} b + a^{3} b^{2}\right )}{\left (a \sin \left (f x + e\right )^{2} - b \sin \left (f x + e\right )^{2} - a\right )}^{2}} + \frac{2 \, \log \left (\sin \left (f x + e\right )^{2}\right )}{a^{3}}}{4 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)/(a+b*tan(f*x+e)^2)^3,x, algorithm="giac")

[Out]

1/4*(2*(3*a^2*b - 3*a*b^2 + b^3)*log(abs(-a*sin(f*x + e)^2 + b*sin(f*x + e)^2 + a))/(a^6 - 3*a^5*b + 3*a^4*b^2
 - a^3*b^3) - (9*a^3*b*sin(f*x + e)^4 - 18*a^2*b^2*sin(f*x + e)^4 + 12*a*b^3*sin(f*x + e)^4 - 3*b^4*sin(f*x +
e)^4 - 18*a^3*b*sin(f*x + e)^2 + 24*a^2*b^2*sin(f*x + e)^2 - 8*a*b^3*sin(f*x + e)^2 + 9*a^3*b - 6*a^2*b^2)/((a
^5 - 2*a^4*b + a^3*b^2)*(a*sin(f*x + e)^2 - b*sin(f*x + e)^2 - a)^2) + 2*log(sin(f*x + e)^2)/a^3)/f